home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / nosnow.arc / NOSNOW.DOC next >
Text File  |  1985-08-28  |  3KB  |  94 lines

  1. The snow on a color graphics adapter occurrs when you change the values
  2. in screen memory during a raster scan, i.e. while the electron gun is
  3. updating the screen from screen memory.  I'm not sure of the exact mechanism,
  4. but this definitely causes interference with the screen update, and the
  5. end result is that ugly snow.
  6.  
  7. One way to avoid this is to wait for "vertical retrace", that time period
  8. during which the electron gun shifts its beam from the lower right-hand
  9. corner of the screen to the upper left.  During vertical retrace, bit 3
  10. of port 3DA (hex) is set on, and the test in TURBO can thus be made:
  11.  
  12.        Repeat until ((port[$3DA] and $08) = $08);
  13.        {*** perform screen update ***}
  14.        {*** note: port $3DA is a read-only register ***}
  15.  
  16. This is how the IBM ROM-BIOS writes a character to the screen, does
  17. scrolling, etc.  But the problem is that vertical retrace lasts a mere
  18. 1.25 miliseconds or so, not enough time to perform complicated and/or
  19. large updates.
  20.  
  21. The other way, the way Sidekick does it, is to turn off the display, do the
  22. update, and turn the display back on.  This is why, when you bring up a
  23. Sidekick window, you see a momentary "flash" on the screen.  The display
  24. enable/disable function is controlled by port 3D8 (hex), a write-only
  25. register.
  26.  
  27. One thing you should know about this is that this whole concept applies only
  28. to the IBM color graphics adapter.  Monochrome displays do not get snow,
  29. and the Enhanced graphics adapter will crap out on you if you turn off the
  30. display in this way.  This is why earlier versions of Sidekick bombed on the
  31. Enhanced graphics adapter.  Current versions of Sidekick work just fine on
  32. the EGA.
  33.  
  34. Use the following, or a similar routine to test what kind of display you
  35. are running on, and then to update the screen:
  36.  
  37. type
  38.  Registertype = Record
  39.   case boolean of
  40.    true : (AX,BX,CX,DX,BP,SI,DI,DS,ES,flags : integer);
  41.    false : (AL,AH,BL,BH,CL,CH,DL,DH : byte)
  42.   end;
  43.  video_mode_ptr = ^video_mode_type;
  44.  video_mode_type = (cga,ega,mono);
  45.  
  46. function get_video_mode : video_mode_ptr;
  47.  var
  48.   regs : registertype;
  49.   equipment : integer;
  50.   ega_info1,
  51.   ega_info2 : byte;
  52.   temp_return : video_mode_ptr;
  53.  begin
  54.   intr($11,regs);
  55.   equipment := regs.AX;
  56.   regs.AH := $12;
  57.   regs.BL := $10;
  58.   intr($10,regs);
  59.   ega_info1 := regs.CL;
  60.   ega_info2 := regs.BH;
  61.   new(temp_return);
  62.   if ((equipment and 52) in [0,16,32]) and (ega_info2=0)
  63.    then
  64.     temp_return^ := ega
  65.    else
  66.     if ((equipment and 48) in [16,32])
  67.       or (((equipment and 52) = 4) and (ega_info1 in [4,5,10,11]))
  68.      then
  69.       temp_return^ := cga
  70.      else
  71.       temp_return^ := mono;
  72.   get_video_mode := temp_return
  73.  end;
  74.  
  75.  begin {* screen update *}
  76.   video_mode := get_video_mode;
  77.   if video_mode^<>mono
  78.    then
  79.     if video_mode^=cga
  80.      then
  81.       begin
  82.        port[$3D8] := $21;
  83.         {*** perform screen updates ***}
  84.        port[$3D8] := $29
  85.       end
  86.      else
  87.       saved_screen := cscr
  88.    else
  89.     saved_screen := mscr
  90.  end; {* screen update*}
  91.  
  92. There seems to be a bit of controversy as to whether the "snow" or the
  93. "flash" is more ascetically displeasing, but I prefer the "flash".
  94. Please upload some applications of this.